//
//  OpenLotteryInfoTableViewCell.m
//  WanCaiC8
//
//  Created by QiuXun on 2019/1/11.
//  Copyright © 2019 tangang. All rights reserved.
//

#import "OpenLotteryInfoCollectionViewCell.h"
#import "LotteryTopView.h"
#import "HomePageVM.h"

@interface OpenLotteryInfoCollectionViewCell()

@property(nonatomic,strong)LotteryTopView *lotteryTopView;



@end
@implementation OpenLotteryInfoCollectionViewCell{
   
    dispatch_source_t _timer;
}


- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        self.contentView.backgroundColor = DEFAULTBGCOLOR;
        
        [self setupUI];
        
        [self getLotteryInfoWithId:@"5"];
    }
    return self;
}


/**
 获取六合彩的开奖信息
 @param lType 六合彩的ltype
 */
- (void)getLotteryInfoWithId:(NSString *)lType{
    WS(weakSelf);
    [[HomePageVM manage] getLotteryInfoWithId:lType Success:^(id returnValue) {
        
         [weakSelf.lotteryTopView setLotteryModel:returnValue];
        
    } andFail:^(NSString *errorMessage, NSError *error) {
        
    }];
}


-(void)setupUI{

    self.lotteryTopView=[[LotteryTopView alloc] init];
    self.lotteryTopView.isShowDownBtn= YES;
    [self.contentView addSubview:self.lotteryTopView];
    [self.lotteryTopView mas_makeConstraints:^(MASConstraintMaker *make) {
        make.edges.equalTo(self.contentView).insets(UIEdgeInsetsMake(5, 10, 5, 10));
    }];
    [self.lotteryTopView layoutIfNeeded];
    self.lotteryTopView.layer.cornerRadius = 10;
    self.lotteryTopView.layer.masksToBounds = YES;
    
}
@end
